import Vue from 'vue'
import VueAxios from 'vue-axios'
import VueMoment from 'vue-moment'
import App from './App'
import axios from './router/axios'
import './permission' // 权限
import './error.js' // 错误日志
import router from './router/router'
import store from './store'
import '@smallwei/avue/lib/index.js'
import '@smallwei/avue/lib/theme-chalk/index.css'
import { loadStyle } from './util/util'
import { validatenull } from '@/util/validate'
import * as urls from '@/config/env'
import { iconfontUrl, iconfontVersion } from '@/config/env'
import * as filters from './filters' // 全局filter
import './styles/common.scss'
import { findByvalue } from '@/util/util'
import echarts from 'echarts'
import AvueMap from 'avue-plugin-map/packages/'
import basicContainer from './components/basic-container/main'
import avueUeditor from 'avue-plugin-ueditor/packages'

Vue.use(avueUeditor)

Vue.use(AvueMap)
Vue.prototype.$echarts = echarts

Vue.prototype.findByvalue = findByvalue
Vue.prototype.validatenull = validatenull
Vue.config.productionTip = false
Vue.use(VueMoment)
Vue.use(VueAxios, axios)
//注册全局容器
Vue.component('basicContainer', basicContainer)
Object.keys(urls).forEach(key => {
  Vue.prototype[key] = urls[key]
})

Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

iconfontVersion.forEach(ele => {
  loadStyle(iconfontUrl.replace('$key', ele))
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
